package com.longma.server.controller;

import com.longma.server.pojo.UserResponseEntity;
import com.longma.server.pojo.vo.AlarmCountVO;
import com.longma.server.pojo.vo.home.*;
import com.longma.server.service.IHomePageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author HAIBO
 * @date 2021-05-10 9:36
 * @description 首页
 */
@RestController
@RequestMapping("/api/home")
public class HomePageController {
    @Autowired
    private IHomePageService homePageService;


    @ApiOperation(value = "发电量统计信息")
    @GetMapping("/generation")
    public UserResponseEntity<PowerGenerationVO> getPowerGeneration(){
        return UserResponseEntity.success(homePageService.getPowerGeneration());
    }

    @ApiOperation(value = "云仓状态信息")
    @GetMapping("/state")
    public UserResponseEntity<List<YuncangStateVO>> getYuncangstate(){
        return UserResponseEntity.success(homePageService.getYuncangstate());
    }


    @ApiOperation(value = "用电量统计信息")
    @GetMapping("/consumption")
    public UserResponseEntity<PowerConsumptionVO> getPowerConsumption(){
        return UserResponseEntity.success(homePageService.getPowerConsumption());
    }

    @ApiOperation(value = "实时发电功率曲线")
    @GetMapping("/real-time-generation")
    public UserResponseEntity<List<PointVO>> getRealTimeGenerationCurve(){
        return UserResponseEntity.success(homePageService.getPowerGenerationCurve());
    }

    @ApiOperation(value = "月发电统计曲线")
    @GetMapping("/month-generation")
    public UserResponseEntity<List<PointVO>> getMonthGenerationCurve(){
        return UserResponseEntity.success(homePageService.getMonthGenerationCurve());
    }

    @ApiOperation(value = "年发电量统计曲线")
    @GetMapping("/year-generation")
    public UserResponseEntity<List<PointVO>> getYearGenerationCurve(){
        return UserResponseEntity.success(homePageService.getYearGenerationCurve());
    }

    @ApiOperation(value = "实时用电功率曲线")
    @GetMapping("/real-time-consumption")
    public UserResponseEntity<List<PointVO>> getRealTimeConsumptionCurve(){
        return UserResponseEntity.success(homePageService.getPowerConsumptionCurve());
    }


    @ApiOperation(value = "月用电量统计曲线")
    @GetMapping("/month-consumption")
    public UserResponseEntity<List<PointVO>> getMonthConsumptionCurve(){
        return UserResponseEntity.success(homePageService.getMonthConsumptionCurve());
    }

    @ApiOperation(value = "年用电量统计曲线")
    @GetMapping("/year-consumption")
    public UserResponseEntity<List<PointVO>> getYearConsumptionCurve(){
        return UserResponseEntity.success(homePageService.getYearConsumptionCurve());
    }

    @ApiOperation(value = "预警信息")
    @GetMapping("/alarm")
    public UserResponseEntity<AlarmCountVO> getAlarmCount(){
        return UserResponseEntity.success(homePageService.getAlarmCount());
    }
}
